home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 36
/
036.d81
/
relatively speak
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
9KB
|
302 lines
100 rem relatively speaking
200 jo=56320
300 gosub20600
400 :
500 forx=1to5:readu$(x):next
600 data "years","days","hours","minutes","seconds"
700 :
800 forx=1to6:readl$(x):next
900 data "inches","feet","miles","centimeters","meters","kilometers"
1000 :
1100 c=300000:fl=0
1200 print"[147]";:gosub21200:pt=1
1300 printspc(7)" - [212]ime transformations":print
1400 printspc(7)" - [204]ength transformations":print
1500 printspc(7)" - [205]ass transformations":print
1600 printspc(7)" - [205]ass-energy relationships":print
1700 printspc(7)" - [210]eturn to [204]oadstar"
1800 print" [205]ove the arrow with the cursor keys"
1900 print" [208]ress [[210][197][212][213][210][206]] to make your selection."
2000 print" [[202]oystick in [208]ort 2 also works]"
2100 print"";:forx=1topt:print"";:next:printspc(8)"==>[157][157][157]";
2200 ifpeek(198)=0andpeek(jo)=127then2200
2300 getag$:j%=peek(jo):print" [144]"
2400 ifag$=""orj%=125thenpt=pt+1
2500 ifag$="[145]"orj%=126thenpt=pt-1
2600 ifag$=chr$(13)orj%=111then3100
2700 ifpt<1thenpt=5
2800 ifpt>5thenpt=1
2900 goto2100
3000 :
3100 on pt goto3200 ,6700,10000,11800,26900
3200 print
3300 gosub15900
3400 gosub13900:print"[147]";:gosub21200
3500 print" [215]ill the duration of the trip be in:":pt=1:f$="years"
3600 print""spc(12)" [217]ears"
3700 printspc(12)" [196]ays"
3800 printspc(12)" [200]ours"
3900 printspc(12)" [205]inutes"
4000 printspc(12)" [211]econds"
4100 print"";:forx=1topt:print"";:next
4200 printspc(12)"==>[157][157][157]";
4300 ifpeek(198)=0andpeek(jo)=127then4300
4400 getag$:j%=peek(jo):print" "
4500 ifag$=""orj%=125thenpt=pt+1
4600 ifag$="[145]"orj%=126thenpt=pt-1
4700 ifag$=chr$(13)orj%=111then5100
4800 ifpt<1thenpt=5
4900 ifpt>5thenpt=1
5000 goto4100
5100 f$=u$(pt)
5200 print" [200]ow long will the trip last"
5300 printspc(10);"==>";:ml=6:gosub19200:t=val(in$):gosub18000
5400 rem calculations and output for time transformations
5500 print"[147]";:gosub21200
5600 print" [215]hen you return from your trip the"
5700 f1$="outside world will be":f2$=str$((1/x)*t)+" "+f$
5800 printspc(20-len(f1$)/2)f1$
5900 printspc(20-len(f2$)/2)f2$
6000 printspc(16)"older."
6100 rem continuation/discontinuation of program
6200 print" [208]ress a key to return to the menu"
6300 ifpeek(198)=0andpeek(jo)<>111then6300
6400 poke198,0
6500 goto1200
6600 end
6700 print
6800 gosub15900
6900 gosub13900
7000 print"[147]";:gosub21200
7100 print" [215]hat units will be used"
7200 pt=1:of=0:ifs$="m"thenof=3
7300 print""spc(10)" "l$(1+of)
7400 printspc(10)" "l$(2+of)
7500 printspc(10)" "l$(3+of)
7600 print"";:forx=1topt:print"";:next
7700 printspc(10)"==>"
7800 ifpeek(198)=0andpeek(jo)=127then7800
7900 getag$:j%=peek(jo)
8000 ifag$=""orj%=125thenpt=pt+1
8100 ifag$="[145]"orj%=126thenpt=pt-1
8200 ifag$=chr$(13)orj%=111then8600
8300 ifpt<1thenpt=3
8400 ifpt>3thenpt=1
8500 goto7300
8600 u$=l$(pt+of):gosub18000
8700 print" [215]hat is the length of the object"
8800 printspc(10)"==>";:ml=6:gosub19200
8900 l=val(in$)
9000 rem calculations and output for length transformations
9100 nl=l-(x*l)
9200 w$="[212]he object will be"+str$(nl):w2$=u$+" shorter."
9300 print"[147]";:gosub21200:print
9400 printspc(20-len(w$)/2)w$
9500 printspc(20-len(w2$)/2)w2$
9600 print" [212]his puts its new length at:"
9700 w$=str$(l-nl)+" "+u$+"."
9800 printspc(20-len(w$)/2)w$:goto6200
9900 print
10000 gosub15900
10100 gosub13900:gosub23300
10200 w$="in "+u$
10300 gosub18000
10400 print"[147]";:gosub21200
10500 print" [215]hat is the mass of the object":printspc(20-len(w$)/2)w$
10600 print" <[206]umber value only>":printspc(11)"==>";:ml=6:gosub19200
10700 m=val(in$)
10800 rem calculations and output for mass transformations
10900 w$="[212]he object's mass has increased by":nm=(1/x)*m-m
11000 m$=str$(nm)+" "+u$+"."
11100 print"[147]";:gosub21200:print""spc(20-len(w$)/2)w$
11200 printspc(20-len(m$)/2)m$
11300 print" [212]his puts its new mass at:"
11400 m$=str$(nm+m)+" "+u$+"."
11500 printspc(20-len(m$)/2)m$
11600 goto6200
11700 :
11800 gosub15900
11900 gosub23300
12000 print"[147]";:gosub21200:print" [215]hat is the mass"
12100 w$="in "+u$:printspc(20-len(w$)/2)w$
12200 printspc(11)"==>";:ml=6:gosub19200:m=val(in$):m=m*di
12300 ifs$="e"thenm=m/2.3
12400 rem calculations and output for mass-energy relationship
12500 e=m*(300000^2):e=4190*e:print
12600 print"[147] [201]f the mass of the object were to be"
12700 print" totally converted into energy, "
12800 w$=str$(e)+" calories":hc=int(e/1.1804e13):hc$=str$(hc)
12850 z=len(hc$):ll=0:ifz>8thenll=1
12900 ef=0:forx=1toz:ifmid$(hc$,x,1)="e"thenef=1
13000 nextx
13005 ifll=1andef=0thenhc$=left$(hc$,2)+"."+mid$(hc$,3,1)+"+e"+mid$(str$(z-2),2)
13100 ifll=1andef=1thenhc$=left$(hc$,2)+right$(hc$,4)
13200 hc$=hc$+" times the energy"
13300 iflen(hc$)<25thenhc$=hc$+" ":goto13300
13400 printspc(20-len(w$)/2)w$
13500 printspc(11)"would be released."
13600 gosub28100
13700 goto6200
13800 rem velocity-time-units conversion subroutine
13900 print"[147]";:gosub21200
14000 print" [215]ill the velocity be:"
14100 t1$="s":f=1:me$="[205]iles":ifs$="m"thenme$="[203]ilometers":pt=1
14200 print""spc(7)" "me$" per second"
14300 print""spc(7)" "me$" per hour"
14400 print"";:forx=1topt:print"";:next
14500 printspc(9)"==>[157][157][157]";
14600 ifpeek(198)=0andpeek(jo)=127then14600
14700 getag$:j%=peek(jo):print" "
14800 ifag$=""orj%=125thenpt=pt+1
14900 ifag$="[145]"orj%=126thenpt=pt-1
15000 ifag$=chr$(13)orj%=111then15400
15100 ifpt<1thenpt=2
15200 ifpt>2thenpt=1
15300 goto14400
15400 ifpt=2thent1$="h":f=3600
15500 print""
15600 printspc(9)"[215]hat is the velocity?":printspc(12)"-->";
15700 ml=6:gosub19200:v=val(in$):v=v/f:gosub18000
15800 return
15900 print"[147]";:gosub21200
16000 print
16100 print" [215]hich measurement system would you":printspc(13)"like to use?"
16200 s$="e":c=186000:pt=1
16300 print""spc(10)" [197]nglish"
16400 print""spc(10)" [205]etric"
16500 print"";:forx=1topt:print"";:next
16600 printspc(10)"==>[157][157][157]";
16700 ifpeek(198)=0andpeek(jo)=127then16700
16800 getag$:j%=peek(jo):print" "
16900 ifag$=""orj%=125thenpt=pt+1
17000 ifag$="[145]"orj%=126thenpt=pt-1
17100 ifag$=chr$(13)orj%=111then17500
17200 ifpt<1thenpt=2
17300 ifpt>2thenpt=1
17400 goto16500
17500 ifpt=2thens$="m":c=300000
17600 print""
17700 rem units choice and coversion subroutine
17800 m=1:l=1:ifs$="e"thenc=186000:iffl=1thenm=m*2.3
17900 return
18000 if(v>186000ands$="e")or(v>300000ands$="m")thengoto18400
18100 ifv=186000ands$="e"thenv=185999
18200 ifv=300000ands$="m"thenv=299999
18300 x=(1-(v/c)^2)^.5:return
18400 print:print"[147] [206]o object can surpass the speed"
18500 printspc(14)"of light.
18800 [153][166]7)"(NULL)se velocities less than"
18900 m$[178]"300,000"[170]" kilometers/second."
19000 [139]s$[178]"e"[167]m$[178]" 186,000"[170]" feet/second."
19002 [153][166]19[171][195](m$)[173]2);
19100 [153]m$:[137]6200
19200 [143] input
19300 [143] pass max length in ml
19400 cu$[178]"tocmd":in$[178]""
19500 [153]cu$;:[151]198,0:[146]198,1:[161]a$:[153]" cmd";
19600 [139]a$[178][199](13)[167]20300
19700 [139]a$[179][177][199](20)[167]19900
19800 aw[178][195](in$):[139]aw[177]0[167]in$[178][200](in$,aw[171]1):[153]"cmd cmd";:[137]19500
19900 [139]a$[177][178]"0"[175]a$[179][178]"9"[167]20100
20000 [137]19500
20100 [139][195](in$)[179]ml[167]in$[178]in$[170]a$:[153]a$;
20200 [137]19500
20300 [139][195](in$)[178]0[167]19500
20400 [142]
20500 :
20600 [153]"load":[151]53281,1:[151]53280,5
20700 [153]" or{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}^"
20800 [153]" {$7d}Loadstar presents{$7d}stop "
20900 [153]" /{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}expstop "
21000 [153]" "
21100 [153]:[141]21200:[137]22400
21200 [153]
21300 [153]" cont "
2